Repository navigation
Invoke-PkProcessWithTimeout starts nothing during an abort or cancel - #96
Merged
Merged
Conversation
Two of the batch's own closures called Complete-PkProcess and Write-PkMessage by name. A .GetNewClosure() block only sees global functions, so a batch failed with "'Complete-PkProcess' is not recognized" when the kit was loaded for one module only. They're captured up front now, like the private helpers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A worker given the function (-SharedFunctionNames takes it) could set a handler made in its own runspace, which the main thread then ran for every message. Running another runspace's scriptblock can hang or crash PowerShell. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
It only looked for an abort after its first 200 ms wait, so a program that finished sooner ran to the end and returned normally, and a slower one ran for about 200 ms before it was killed. It now throws before starting the program, unless -IgnoreAbort is given. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Invoke-PkProcessWithTimeoutstarted its program even when an abort or cancel was already in force. It only looked for one after its first 200 ms wait, so a program that finished sooner ran to the end and returned normally, and a slower one ran for about 200 ms before it was killed. The README says it throws when the run is aborted, and the batch starts nothing then.-IgnoreAbortskips it, as it does the one in the loop. A bad argument is still reported first.This changes behavior: a quick program run during an abort without
-IgnoreAbortused to work by luck. That includes a cleanup program in-JobAbortCleanup, and one run after an abortedInvoke-PkRunreturns, since an abort stays in force untilReset-PkAbortState. Those need-IgnoreAbortnow.Tests
Section S runs a program that writes a file, so a run leaves a trace: during an abort, and in a worker whose run is canceled.
during an abort, a quick program isn't startedandin a worker whose run is canceled, a quick program isn't started, except with -IgnoreAbort(nothing thrown).-IgnoreAbortstill runs the program.🤖 Generated with Claude Code